﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace TV4Home.MvcWebInterface.UI.Controllers
{
    public class MusicLibraryController : Controller
    {
        public ActionResult Index()
        {
            var artistList = WebService.GmaWebService.ServiceInstance.MP_GetAllArtists();
            return View(artistList);
        }

        public ActionResult Albums(string artist)
        {

            var albumList = WebService.GmaWebService.ServiceInstance.MP_GetAlbumsByArtist(artist);

            return View(albumList);
        }
        public ActionResult Tracks(string album, string artist)
        {
            var trackList = WebService.GmaWebService.ServiceInstance.MP_GetSongsOfAlbum(album, artist);
            return View(trackList);
        }

        public ActionResult Play(int track)
        {
            var musicTrack = WebService.GmaWebService.ServiceInstance.MP_GetMusicTrack(track);
            return View(musicTrack);
        }
        public ActionResult Image(string album, string artist)
        {
            byte[] image = System.IO.File.ReadAllBytes(WebService.GmaWebService.ServiceInstance.MP_GetAlbum(artist, album).CoverPathL);
            return File(image, "image/jpg");
        }

    }
}
